<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!-- 不允许有<和% -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <!-- Title and other stuffs -->
  <title>登录</title> 
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="author" content="">
  <!-- Stylesheets -->
  <link href="style/bootstrap.css" rel="stylesheet">
  <link rel="stylesheet" href="style/font-awesome.css">
  <link href="style/style.css" rel="stylesheet">
  <link href="style/bootstrap-responsive.css" rel="stylesheet">
  
  <!-- HTML5 Support for IE -->
  <!--[if lt IE 9]>
  <script src="js/html5shim.js"></script>
  <![endif]-->

  <!-- Favicon -->
  <link rel="shortcut icon" href="img/favicon/favicon.png">
</head>

<body onload="myLoad()">

<!-- Form area -->
<div class="admin-form">
  <div class="container">

<div class="row">
<div class="col-md-12">
  <!-- Widget starts -->
<div class="widget worange">
<!-- Widget head -->
<div class="widget-head">
  <i class="icon-lock"></i> 登录 
</div>

     <div class="widget-content">
     <div class="padd">
     <!-- Login form -->
     <form class="form-horizontal" action="./LoginServlet" method="post" onsubmit="return checkInput();">
       <!-- Email -->
       <div class="form-group">
         <label class="control-label col-lg-3" for="inputEmail">登录名</label>
         <div class="col-lg-9">
           <input type="text" class="form-control" id="txtLoginName" name="txtLoginName"
            placeholder="登录名" value="${requestScope.LoginName}"><!-- placeholder -->
           <span class="label label-danger" id="spanLoginName"></span>
         </div>
       </div>
      <!-- Password -->
      <div class="form-group">
        <label class="control-label col-lg-3" for="inputPassword">密码</label>
        <div class="col-lg-9">
	          <input type="password" class="form-control" id="txtPassword" name="txtPassword" 
	          placeholder="密码">
	          <span class="label label-danger" id="spanPassword"></span>
        </div>
      </div>
      <!-- Remember me checkbox and sign in button -->
      <div class="form-group">
	  <div class="col-lg-9 col-lg-offset-3">
      <div class="checkbox">
      <label>
      <input type="checkbox" name="chkRememberLoginName" value="true"> 记住登录名
      </label>
	  </div>
	  </div>
	  </div>
	  <div class="col-lg-9 col-lg-offset-2">
	  <button type="submit" class="btn btn-danger">登录</button>
	  <button type="reset" class="btn btn-default">取消</button>
   	  </div>
      <br />
     </form>
				  
		</div>
	    </div>
	           
        <div class="widget-foot">
                  是否注册？ <a href="./RegisterServlet">注册</a></br>
                  忘记密码？ <a href="./ResetPasswordServlet">重置密码</a>
        </div>
        </div>  
      </div>
    </div>
  </div> 
</div>

<!-- JS -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script type="text/javascript">
function checkInput(){
	var flag = true;
	var txtLoginName = document.getElementById("txtLoginName");
	var spanLoginName = document.getElementById("spanLoginName");
	var txtPassword = document.getElementById("txtPassword");//通过Id在文档中获得元素，id;某一个表单的属性，通常用来表示表单当中唯一的元素
	var spanPassword = document.getElementById("spanPassword");
	if(txtLoginName.value.length == 0){
		spanLoginName.innerHTML = "登录名不能为空。";
		flag = false;
	}
	else if(txtLoginName.value.length < 5){
		spanLoginName.innerHTML = "登录名不能少于5个字符。";
		flag = false;
	}
	else{
		spanLoginName.innerHTML="";	
	}
	
	if(txtPassword.value.length == 0){
		spanPassword.innerHTML = "密码不能为空。";	
		flag = false;	
	}
	else if(txtPassword.value.length < 5){
		spanPassword.innerHTML = "密码至少5个字符。";
		flag = false;	
	}
	else {
		spanPassword.innerHTML="";	
	}
	return flag;
}


function myLoad(){
 ${alertMessage}
}
</script>
</body>
</html>



